package org.example.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.example.mapper.TechnicianMapper;
import org.example.pojo.Technician;
import org.example.pojo.vo.TechnicianVo;
import org.example.service.TechnicianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class TechnicianServiceImpl extends ServiceImpl<TechnicianMapper, Technician> implements TechnicianService {

    @Autowired
    private TechnicianMapper technicianMapper;


    @Override
    public List<Technician> findAll(Technician technician) {
        LambdaQueryWrapper<Technician> wrapper = new LambdaQueryWrapper<>();
         if (technician.getTechnicianName() != null){
             wrapper.like(Technician::getTechnicianName, technician.getTechnicianName());
         }
         if(technician.getStatus()!=null){
             wrapper.eq(Technician::getStatus, technician.getStatus());
         }
        return technicianMapper.selectList(wrapper);
    }

    @Override
    public Technician selectStatus(Technician technician) {
        if (technician.getStatus() != null){
            return technicianMapper.selectStatus(technician);
        }
        return null;
    }

    @Override
    public List<Technician> selectPrice(TechnicianVo technician) {
         return technicianMapper.selectPrice(technician);

    }

    @Override
    public List<Technician> selectXiao() {
        return technicianMapper.selectXiao();
    }

    @Override
    public List<Technician> selectHao() {
        return technicianMapper.selectHao();
    }

//    @Override
//    public Technician selectXiao() {
//
//        return technicianMapper.selectXiao();
//    }

//    @Override
//    public Technician selectStatus(Technician technician) {
//        if (technician.getStatus() != null){
//            return technicianMapper.selectStatus(technician);
//        }
//        return null;
//    }
}
